/**
 * @Author: lusx
 * @Date:   14-03-2019 04:19:18
 * @Project: Govern督办
 * @Last modified by:   lusx
 * @Last modified time: 27-03-2019 01:22:55
 */
import React, { Component } from "react";
import { observer, inject } from "mobx-react";
import { withRouter } from "react-router-dom";
import { List } from "weaver-mobile";
import { Form } from "weaver-mobile-page";
import { asyncComponent } from "react-async-component";
import HocRouteLayout from "../hocs/hocRouteLayout.js";
const coms = {
  ComForm: asyncComponent({
    resolve: () => import("../comForm/comForm.js")
  })
};

//form形式的对话框
//@inject("actionSheetStore")
@inject("mainStore")
@withRouter
@observer
@HocRouteLayout
export default class ComDialogForm extends Component {
  state = {
    height: "100%"
  }
  componentDidMount(){
    const {location:{pathname}} = this.props; 
    if(pathname.endsWith("govern")){
      const height = document.getElementsByClassName("wm-form")[0].clientHeight - 47;
      this.setState({height});
    }
 
  }
  render() {
    const {
      mainStore: {actionSheetStore: { gform }
    }} = this.props;
    const {height} = this.state;
    return (
      <Form style={{ height: height }}>
        <List>
          <coms.ComForm comForm={gform} />
        </List>
      </Form>
    );
  }
}
